What's a unit test? [closed]

Posted by Tyler on Stack Overflow See other posts from Stack Overflow or by Tyler
Published on 2009-07-13T21:32:47Z Indexed on 2010/04/29 4:27 UTC
Read the original article Hit count: 201

Possible Duplicates:
What is unit testing and how do you do it?
What is unit testing?

I recognize that to 95% of you, this is a very WTF question.

So. What's a unit test? I understand that essentially you're attempting to isolate atomic functionality but how do you test for that? When is it necessary? When is it ridiculous? Can you give an example? (Preferably in C? I mostly hear about it from Java devs on this site so maybe this is specific to Object Oriented languages? I really don't know.)

I know many programmers swear by unit testing religiously. What's it all about?

EDIT: Also, what's the ratio of time you typically spend writing unit tests to time spent writing new code?

© Stack Overflow or respective owner

Related posts about unit-testing

Related posts about best-practices